#习题5：更多的变量和打印
#使用“格式化字符串（format string）”
'''
格式符为真实值预留位置，并控制显示的格式。格式符可以包含有一个类型码，用以控制显示的类型，如下:
%s    字符串 (采用str()的显示)
%r    字符串 (采用repr()的显示)
%c    单个字符
%b    二进制整数
%d    十进制整数
%i    十进制整数
%o    八进制整数
%x    十六进制整数
%e    指数 (基底写为e)
%E    指数 (基底写为E)
%f    浮点数
%F    浮点数，与上相同
%g    指数(e)或浮点数 (根据显示长度)
%G    指数(E)或浮点数 (根据显示长度)
%%    字符"%"
'''

my_name = "Zed A. Shaw";
my_age = 35;
my_height = 74; #inches
my_weight = 180; # lbs
my_eyes = "Blue";
my_teeth = "White";
my_hair = "Brown";

print ("Let's talk about %s." % my_name);
print ("He's %d inches tall." % my_height);
print ("He's %d pounds heavy." % my_weight);
print ("Actually that's not too heavy.");
print ("He's got %s eyes and %s hair." %(my_eyes,my_hair));
print ("His teeth are usually %s depending on the coffee." % my_teeth);
#this line is tricky,try to get it exactly right
print ("If I add %d,%d,and %d I get %d." % 
(my_age,my_height,my_weight,my_age + my_height + my_weight));

#加分题

print ("=============以下加分题=================");
name = "Zed A. Shaw";
age = 35;
height = 74; #inches
weight = 180; # lbs
eyes = "Blue";
teeth = "White";
hair = "Brown";

print ("Let's talk about %s." % name);
print ("He's %d inches tall." % height);
print ("He's %d cm tall." % (height * 2.54));
print ("He's %d pounds heavy." % weight);
print ("He's %d KG heavy." % (weight * 0.45359));
print ("Actually that's not too heavy.");
print ("He's got %s eyes and %s hair." %(eyes,my_hair));
print ("His teeth are usually %s depending on the coffee." % teeth);
#this line is tricky,try to get it exactly right
print ("If I add %d,%d,and %d I get %d." % 
(age,height,weight,age + height + weight));